//
//  JMOrderContentVC.m
//  NewiOSProject
//
//  Created by JMMac on 13.1.24.
//  Copyright © 2024 范智渊. All rights reserved.
//

#import "JMOrderContentVC.h"

#import "SGPagingView.h"
#import "JMOrderVC.h"

@interface JMOrderContentVC ()<SGPageContentScrollViewDelegate, SGPageTitleViewDelegate>
{
    NSInteger curSeleIndex;
}
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
@property (nonatomic, strong) SGPageContentScrollView *pageContentScrollView;

@end

@implementation JMOrderContentVC


- (void)viewDidLoad {
    [super viewDidLoad];
    self.NavImg.backgroundColor = WhiteColor();
    self.backBtn.hidden = YES;
    self.TitleLabel.text = @"Pedidos";
    
    SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
    configure.titleSelectedColor = Hex_Str_COLOR(@"#3C57F8");
    configure.titleColor = Hex_Str_COLOR(@"#999999");
    configure.titleFont = Font(14);
    configure.titleSelectedFont = fontWithWeight(14, UIFontWeightSemibold);
    configure.indicatorStyle = SGIndicatorStyleDefault;
    configure.indicatorHeight = 2;
    configure.indicatorColor = Hex_Str_COLOR(@"#4148A4");
    configure.titleAdditionalWidth = 20;
    configure.needBounces = NO;
    configure.bottomSeparatorColor = UIColor.clearColor;
    
    _pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT(), kAppW(), 55) delegate:self titleNames:@[@"Pedidos actuales",@"Pedidos históricos"] configure:configure];
    _pageTitleView.selectedIndex = 0;
    _pageTitleView.backgroundColor = UIColor.whiteColor;
    [self.view addSubview:_pageTitleView];
    
    JMOrderVC  *actVC = JMOrderVC.new;
    actVC.type = @"1";
    JMOrderVC *hisVC = JMOrderVC.new;
    hisVC.type = @"2";
    NSArray *childCtrls =@[actVC,hisVC];
    //注入数据
    _pageContentScrollView = [[SGPageContentScrollView alloc] initWithFrame:CGRectMake(0, _pageTitleView.bottom, kAppW(),kAppH()-_pageTitleView.bottom - TAB_BAR_HEIGHT()) parentVC:self childVCs:childCtrls];
    _pageContentScrollView.delegatePageContentScrollView = self;
    _pageContentScrollView.backgroundColor = UIColor.clearColor;
    [self.view addSubview:_pageContentScrollView];
    
}
//SGPagerViewDelegate
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex {
    [self.pageContentScrollView setPageContentScrollViewCurrentIndex:selectedIndex];
    curSeleIndex = selectedIndex;
}

- (void)pageContentScrollView:(SGPageContentScrollView *)pageContentScrollView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex {
    [self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
